package hxy.bytecode.algorithm;

import java.util.Arrays;

public class 合并两有序数组 {

	public static void main(String[] args) {
				int[] a = new int[]{0,3,7,8,13};
				int[] b = new int[]{1,2,4,6,9,10,12,15,17};
				int[] c = new int[a.length+b.length];
				int i=0,j=0,k=0;
				while(i<a.length&&j<b.length){
					if(a[i]<=b[j]){
						c[k++]=a[i++];
					}else{
						c[k++] =b[j++];
					}
				}
				while(i<a.length){
					c[k++]=a[i++];
				}
				while(j<b.length){
					c[k++]=b[j++];
				}
					System.out.print(Arrays.toString(c));
	}
}
